package utilTest;

import aiyh.utils.annotation.recordset.*;
import entity.ImageInfo;
import mybatisTest.entity.License;

import java.util.List;
import java.util.Map;

/**
 * @author @author EBU7-dev1-ay
 * create 2021/12/19 0019 17:24
 */
@SqlMapper
public interface ITestMapper {
    @Select("select * from laji where id = #{idparam} and " +
            "name = #{name} or age > #{age} and loginid = #{map.loginid}")
    Object selectOne(@ParamMapper("idparam") String id, String name, int age,
                     @ParamMapper("map") Map<String,Object> map);

    @Select(custom = true)
    License selectOne(@SqlString String sql);

    @Select("select * from lj where id = #{id} and name like #{nameLike} and age > #{age}")
    Object selectOne(@ParamMapper("id") String id,
                     @ParamMapper("nameLike") String nameLike,
                     @ParamMapper("age") int age);

    @Select("select * from table where id = #{id} and name like #{nameLike} and age > ${age}" +
            " and account = #{user.account} or userid = {user.uID}")
    @CaseConversion(false)
    Object selectOne(Map<String,Object> map);

    @Select("select companyname company_name,license,expiredate expire_date,CVERSION c_version from  license;")
    License selectOne();

    @Select(value = "select imagefileid image_file_id,imagefilename image_file_name," +
            "docid doc_id,id,operatedate operate_date,operatetime operate_time" +
            " from docimagefile where docid in (${list})",custom = true)
    List<ImageInfo> selectList(@SqlString String sql, List<Integer> list);


    @Update("update hrmresource set email = #{email} where id > #{min} and id < #{max}")

    void updateEmail(@ParamMapper("email") String email,
                     @ParamMapper("min") int min,
                     @ParamMapper("max") int max);
}
